The present invention relates to an apparatus and a method for image processing as well as a storage medium for the same, and particularly to an apparatus and a method for image processing as well as a storage medium that are preferably used for transforming a dynamic range of intensity levels of pixels forming an image.
As the performance of CCDs (Charge Coupled Devices) installed in electronic apparatuses that have the ability to acquire image data, such as digital cameras, scanners and the like, has become higher, a gradation dynamic range of images tends to become wider.
However, when images having a wider gradation dynamic range than conventional one (hereinafter referred to as “wider dynamic range images”) are supplied to reproducing apparatuses such as displays, printers and the like, which correspond to images having conventional dynamic range (hereinafter referred to as “narrower dynamic range images”), there is a need for a gradation correction technique that transforms the wider dynamic range images into the narrower dynamic range images.
As one of conventional gradation correction techniques, a histogram equalization method is well known. The histogram equalization method transforms pixels' intensity levels so that the intensity levels are distributed uniformly over an entire image.
A basic algorithm for the histogram equalization method will be now described. As shown in FIG. 1A, a histogram showing a frequency of every intensity level for an input image (an image before transformation), a histogram showing the number of pixels having identical intensity levels is generated. Assuming that a frequency of an intensity level Xn is H(Xn) (n=0, 1, 2, . . . , max), the histogram thereof is cumulated. More specifically, a cumulative frequency H (X0) for an intensity level X0 is set to H(X0); a cumulative frequency H(X1) for an intensity level X1 is obtained by calculation of [H(X0)+H(X1)]; a cumulative frequency H(X2) for an intensity level X2 is obtained by calculation of [H(X0)+H(X1)+H(X2)]; and a cumulative frequency H(Xmax) for an intensity level Xmax is obtained by calculation of [H(X0)+H(X1)+ . . . +H(Xmax)]. As a result of such cumulation, a cumulative histogram is generated. Further, a look up table (hereinafter referred to as “LUT”) shown in FIG. 1B is generated by adapting a dynamic range (X′0–X′max) of intensity levels of an output image to a range from the cumulative frequency H(X0) for the intensity level X0 to the cumulative frequency H(Xmax) for the intensity level Xmax (the vertical axis of the cumulative histogram).
When the intensity levels of the input image are transformed using the LUT generated in this manner, the resultant output image has a uniform frequency (an even distribution) of its intensity levels as shown in a histogram of FIG. 1C and therefore has a more enhanced contrast.
However, when such histogram equalization method is adapted to an input image that has an extreme peak of its intensity frequency, intensity levels near the peak may be transformed into a wider range within the dynamic range of a resultant output image, and therefore a desired result may not be obtained (the resultant image may be indistinct).
In addition, in the conventional gradation correction technique, since human visual characteristics, that is, more particularly, Weber-Fechner's law stating that “human sensation is proportional to the logarithm of stimulus intensity” are not considered, the narrower dynamic range image as a result of the transformation may be indistinct.